<template>
  <div class="count">
    <h1>Count</h1>
    <h2>当前的num值是:{{ $store.state.Count.num }}</h2>
    <h2>当前的num值是:{{ num }}</h2>
    <h2>当前的doubleNum值是:{{ doubleNum }}</h2>
    <h3>下边的组件电影总共有{{ movieList.length }}个</h3>
    <div>
      <button @click="increment">累加num</button>
      <button @click="incrementN({ n: 2 })">累加N -- num</button>

      <button @click="incrementWait">延迟1s累加</button>
      <button @click="incrementNWait({ n: 2 })">延迟1s累加n</button>
    </div>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
export default {
  name: "Count",
  mounted() {
    console.log(this);
  },
  methods: {
    ...mapMutations("Count", ["increment", "incrementN"]),
    ...mapActions("Count", ["incrementWait", "incrementNWait"]),
  },
  computed: {
    ...mapState("Count", ["num"]),
    ...mapGetters("Count", ["doubleNum"]),

    ...mapState("Movie", ["movieList"]),
  },
};
</script>

<style scoped>
.count {
  background: pink;
}
</style>
